package com.hehua.MediatorPattern;

public class Client {
    public static void main(String[] args) {
        //定义中介者对象
        ConcreteMediator mediator;
        mediator = new ConcreteMediator();

        //定义同事对象
        Button button = new Button();
        List list = new List();
        ComboBox comboBox = new ComboBox();
        TextBox textBox = new TextBox();

        button.setMediator(mediator);
        list.setMediator(mediator);
        comboBox.setMediator(mediator);
        textBox.setMediator(mediator);

        mediator.button = button;
        mediator.list = list;
        mediator.comboBox = comboBox;
        mediator.textBox =textBox;

        button.changed();
        System.out.println("-------------------");
        list.changed();
    }
}
